﻿@{
    ViewBag.Title = "采购单信息";
}

@model PagerModel<PurchaseOrder>

<div class="card card-primary">
    <div class="card-header">
        采购单信息
    </div>
    <div class="card-body table-responsive p-3">
        <form asp-action="PurchaseOrderInfo" method="get" class="card-title">
            <input type="hidden" name="CurrentPage" value="@Model.PageIndex" />
            <input type="hidden" name="Sorting" value="@Model.FilterText" />
            <p>
                请输入采购单号：
                <input type="text" name="FilterText" value="@Model.FilterText" />
                <input type="submit" value="查询" class="btn btn-outline-dark btn-sm" />
            </p>
        </form>

        <table class="table table-hover text-nowrap table-bordered">
            <thead class="thead-light">
                <tr>
                    <th>操作</th>
                    <th class="sr-only">ID</th>
                    <th>采购单号</th>
                    <th>物料编码</th>
                    <th>物料名称</th>
                    <th>审核人</th>
                    <th>审核时间</th>
                    <th>审核状态</th>
                    <th>采购总数</th>
                    <th>采购类型</th>
                    <th>创建人</th>
                    <th>创建时间</th>
                    <th>产地</th>
                    <th>备注</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.Data)
                {
                    <tr>
                        @* checked="checked" *@
                        <td> <input type="radio" name="tableRadio" id="radio_@item.Id" class="tableRadio"></td>
                        <td class="sr-only">@item.Id</td>
                        <td>@item.PurchaseOrderNo</td>
                        <td>@item.ItemCode</td>
                        <td>@item.ItemName</td>
                        <td>@item.ReviewBy</td>
                        <td>@item.ReviewDate?.ToString("D")</td>
                        <td>@item.ReviewState</td>
                        <td>@item.PurchaseCount</td>
                        <td>@item.PurchaseOrderType</td>
                        <td>@item.CreateBy</td>
                        <td>@item.CreateDate.ToString("D")</td>
                        <td>@item.Address</td>
                        <td>@item.Remark</td>
                    </tr>
                }
            </tbody>
        </table>
        <div class="btn-group" style="margin-top:10px;">
            @await Html.PartialAsync("_Pagination")
        </div>
    </div>
    <div class="card-footer">
        <a class="btn btn-primary" onclick="FunSave()">保&nbsp;存</a>
        <a class="btn btn-default" asp-controller="ReturnOrder" asp-action="ReturnOrderEdit">返&nbsp;回</a>
    </div>
</div>
<script>
    function FunSave() {
        var radios = $('.tableRadio');
        var RadioIds = new Array();
        for (var i = 0; i < radios.length; i++) {
            if (radios[i].checked) {
                RadioIds.push(radios[i].id.split('_')[1]);
            }
        }
        alert('本页面：'+RadioIds.toString());

    }
</script>